package org.opendatakit.sensors.wifi;

import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.UnknownHostException;

public class WifiDevice {

	public static final String ACTION_FOUND = "odk.wifi.action.found";
	public static final String ACTION_BOND_STATE_CHANGED = "odk.wifi.action.bond.state.changed";
	protected static final String EXTRA_DEVICE = "odk.wifi.extra.device";
	private String macAddress;
	private String ip;
	private int port;
	private String name;
	
	public WifiDevice(String id,String name){
		this.macAddress=id;
	}
	
	public String getIp() {
		return ip;
	}
	public String getAddress() {
		return macAddress;
	}
	
	public int getPort() {
		return port;
	}
	
	public void setPort(int port) {
		this.port=port;
	}
	
	public String getName() {
		return name;
	}
	
	public void setIp(String ipAddress){
		this.ip=ipAddress;
	}

	public DatagramPacket getPacket(String data) throws UnknownHostException {
		byte[] buf= data.getBytes();
		DatagramPacket dp = new DatagramPacket(buf , buf.length , InetAddress.getByName(ip), port);	
		return dp;
	}

}
